/*Replication file for "A Good Partisan? Ideology, Loyalty, and Public Evaluations of Members of Congress" by Geoff Sheagley, Logan Dancey, and John Henderson. Legislative Studies Quarterly*/

//Do file by Logan Dancey

//Replication file to generate regression coefficients reported in Table 2 and appendix of manuscript */

*Opening 2021 CES

*Run this .do file after the 2021CESMerge

*Create new approval variable with more approval higher and not sure treated as missing

tab CC21_315f
gen approve_rep=CC21_315f
replace approve_rep=. if approve_rep==5
replace approve_rep=abs(4-approve_rep)
label define approve_rep 0 "Strongly Disapprove" 1 "Somewhat Disapprove" 2 "Somewhat Approve" 3 "Srongly Approve"
label value approve_rep approve_rep
tab approve_rep CC21_315f
tab1 approve_rep CC21_315f


*Create 3 point party id variable from pid7
tab pid7
tab pid7, nolabel
recode pid7 (1/3=1)(4=2)(5/7=3)(8/9=.), gen(pid3_lean)
label define pid3_lean 1 "Democrat" 2 "Independent" 3 "Republican"
label values pid3_lean pid3_lean
tab pid3_lean pid7

***Regressions w/ Trump Vote
*Democrats -- Table 2
regress approve_rep nominate_dim1 nominate_dim2 impeach_trump i.pid7 if party==200 & pid3_lean==1 [pw=commonweight], cluster(bioname)

*Republicans -- Table 2
regress approve_rep nominate_dim1 nominate_dim2 impeach_trump i.b7.pid7 if party==200 & pid3_lean==3 [pw=commonweight], cluster(bioname)

*Independents -- Appendix
regress approve_rep nominate_dim1 nominate_dim2 impeach_trump i.pid7 if party==200 & pid3_lean==2 [pw=commonweight], cluster(bioname)



